from import_export import resources
from import_export.fields import Field

from apps.home.models import LackBus


class LackBusResource(resources.ModelResource):
    comp = Field(attribute='comp', column_name=LackBus.comp.field.verbose_name)
    op_date = Field(attribute='op_date', column_name=LackBus.op_date.field.verbose_name)
    seq = Field(attribute='seq', column_name=LackBus.seq.field.verbose_name)
    line = Field(attribute='line', column_name=LackBus.line.field.verbose_name)
    word_track = Field(attribute='word_track', column_name=LackBus.word_track.field.verbose_name)
    plate = Field(attribute='plate', column_name=LackBus.plate.field.verbose_name)
    bus_type = Field(attribute='bus_type', column_name=LackBus.bus_type.field.verbose_name)
    plate_v2 = Field(attribute='plate_v2', column_name=LackBus.plate_v2.field.verbose_name)
    start_time = Field(attribute='start_time', column_name=LackBus.start_time.field.verbose_name)
    end_time = Field(attribute='end_time', column_name=LackBus.end_time.field.verbose_name)
    situation = Field(attribute='situation', column_name=LackBus.situation.field.verbose_name)
    station = Field(attribute='station', column_name=LackBus.station.field.verbose_name)
    lack_trip_num = Field(attribute='lack_trip_num', column_name=LackBus.lack_trip_num.field.verbose_name)
    sup_trip_num = Field(attribute='sup_trip_num', column_name=LackBus.sup_trip_num.field.verbose_name)
    total_lack_trip_num = Field(attribute='total_lack_trip_num', column_name=LackBus.total_lack_trip_num.field.verbose_name)
    lack_bus_start_time = Field(attribute='lack_bus_start_time', column_name=LackBus.lack_bus_start_time.field.verbose_name)
    sup_bus_start_time = Field(attribute='sup_bus_start_time', column_name=LackBus.sup_bus_start_time.field.verbose_name)
    submit_date = Field(attribute='submit_date', column_name=LackBus.submit_date.field.verbose_name)
    category = Field(attribute='category', column_name=LackBus.category.field.verbose_name)
    type = Field(attribute='type', column_name=LackBus.type.field.verbose_name)

    class Meta:
        exclude = ['id']
        model = LackBus

